<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://www.groupwareworkbench.org.br/widgets/commons" prefix="Widgets"%>
<%@ taglib uri="http://www.groupwareworkbench.org.br/widgets/tag" prefix="TagMgr" %>
<%@ taglib uri="http://www.groupwareworkbench.org.br/widgets/collections" prefix="coll" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
    <head>
        <title>Not&iacute;cias</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="${pageContext.request.contextPath}/css/common.css" rel="stylesheet" type="text/css" />
        <link href="${pageContext.request.contextPath}/css/tagcloud.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/listagem.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.js"></script>
        <script type="text/javascript">
            function renderizarCelulaNoticia(celula, coluna, elem) {
                elem.css({"text-align": coluna.esquerda ? "left" : "right"});
                var link = $("<a></a>");
                elem.append(link);
                link.attr("href", celula.url);
                link.html(celula.titulo);
            }

            function criarCelulaNoticia(tabela, url, titulo) {
                var celula = new CelulaCallback(renderizarCelulaNoticia);
                celula.titulo = titulo;
                celula.url = url;
                tabela.addCelulaElemento(celula);
            }
        </script>
        <Widgets:Tabela baseUrl="/groupware-workbench/${newsMgr.id}/news"
                        msgAdd="Adicionar nova notícia"
                        msgDelete="Tem certeza que deseja excluir a notícia?"
                        msgVazio="Não há notícias registradas."
                        target="tabela-noticias"
                        cellProcessFunc="criarCelulaNoticia"
                        rowProcess="true"
                        titles="${coll:asList1('Notícia')}"
                        columns="${coll:asList2('!URL/show', 'title')}"
                        elements="${newsList}" />
    </head>
    <body>
        <Widgets:Topo collabletInstance="${newsMgr}" />
        <Widgets:ConteudoPagina titulo="News">

            <div id="subtitle_1">
                <span class="subTitulo">Configura&ccedil;&atilde;o</span>
                <Widgets:Configuracao collabletInstance="${newsMgr}" />
            </div>

            <div id="subtitle_2">
                <span class="subTitulo">
                    <a href="<c:url value="/groupware-workbench/${newsMgr.id}/news/configure" />">Configura&ccedil;&atilde;o de Not&iacute;cias</a>
                </span>
            </div>

            <div id="subtitle_3">
                <span class="subTitulo">Lista de not&iacute;cias</span>
                <div id="tabela-noticias"></div>
            </div>

            <c:if test="${not empty newsMgr.subordinatedInstances}">
                <div id="subtitle_4">
                    <span class="subTitulo">Collablets</span>
                    <Widgets:MenuFerramentas collabletInstance="${newsMgr}" groups="${groups}" />
                </div>
            </c:if>
            <c:if test="${tagMgr != null}">
				<div style="padding: 20px">
    	            <TagMgr:TagCloud tagMgr="${tagMgr}" collabletInstance="${newsMgr}"/>
    	        </div>
            </c:if>
            <div class="barra_botoes">
                <Widgets:Voltar collabletInstance="${newsMgr.parent}" />
            </div>
        </Widgets:ConteudoPagina>
    </body>
</html>